﻿using Authentication.Core.Data.DataContextStorage;
using System.Web;

namespace Customer.Core.Data.DataContextStorage
{
    public class DataContextStorageFactory
    {
        public static IDataContextStorageContainer dataContextStorageContainer;

        public static IDataContextStorageContainer CreateStorageContainer()
        {
            if (dataContextStorageContainer == null)
            {
                if (HttpContext.Current == null)
                    dataContextStorageContainer = new ThreadDataContextStorageContainer();
                else
                    dataContextStorageContainer = new HttpDataContextStorageContainer();
            }

            return dataContextStorageContainer;
        }
    }
}
